#include <iostream>
#include <fstream>
#include <vector>
using namespace std;
long cmmd(long, long);
class NrMare
{
    long val;
public:
    NrMare();
    NrMare(long);
    ~NrMare();
    NrMare operator+(NrMare);
    NrMare operator-(NrMare);
    NrMare operator/(NrMare);
    NrMare operator*(NrMare);
    long getVal();
    void setVal(long);
    bool operator<(NrMare);
    bool operator>(NrMare);
    bool operator==(NrMare);
    bool operator!=(NrMare);
    friend istream& operator>>(istream&, NrMare&);
    friend ostream& operator<<(ostream&, NrMare);
    //friend ifstream& operator>>(ifstream&,NrMare);
    //friend ofstream& operator<<(ofstream&, NrMare);
};

class sirNr
{
    vector <NrMare> v;
    long nr_elem;
public:
    sirNr();
    ~sirNr();
    long maxim();
    void prime();
    void sort();
    void trim();
    double average();
    long cmmdc();
    long divide(short);
    bool distinct();
    friend istream& operator>>(istream&, sirNr&);
    friend ostream& operator<<(ostream&, sirNr);

};

NrMare::NrMare():val(0) {}
NrMare::NrMare(long x):val(x){}
NrMare::~NrMare() {};
NrMare NrMare::operator+(NrMare x)
{
    return val+x.val;
}
NrMare NrMare::operator*(NrMare x)
{
    return val*x.val;
}
NrMare NrMare::operator-(NrMare x)
{
    return val-x.val;
}
NrMare NrMare::operator/(NrMare x)
{
    return val/x.val;
}
long NrMare::getVal()
{
    return val;
}
void NrMare::setVal(long x)
{
    val=x;
}
bool NrMare::operator<(NrMare x)
{
    if (val<x.val)
        return true;
    else return false;
}
bool NrMare::operator>(NrMare x)
{
    if (val>x.val)
        return true;
    else return false;
}
bool NrMare::operator==(NrMare x)
{
    if (val==x.val)
        return true;
    else return false;
}
bool NrMare::operator!=(NrMare x)
{
    if (val!=x.val)
        return true;
    else return false;
}
istream& operator>>(istream& in, NrMare& x)
{
    in>>x.val;
    return in;
}
ostream&operator<<(ostream& out, NrMare x)
{
    out<<x.val;
    return out;
}
ifstream& operator>>(ifstream& fin, NrMare& x)
{
    fin>>x;
    return fin;
}
ofstream& operator<<(ofstream& out, NrMare x)
{
    out<<x;
    return out;
}
sirNr::sirNr()
{
    cout<<"nr elem:";
    cin>>nr_elem;
    v.resize(nr_elem);
}
sirNr::~sirNr() {}

long sirNr::maxim()
{
    NrMare max=v[0];
    for (int i=1;i<nr_elem;i++)
    {
        if (max<v[i])
            max=v[i];
    }
    return max.getVal();
}

void sirNr::prime()
{
    bool ok;
    for (int i=0; i<nr_elem;i++)
    {  ok=true;
        for( int j=1;j<int (v[i].getVal()/2);j++)
            if (v[i].getVal() % j !=0)
                ok=false;
        if (ok)
            cout<<v[i]<<' ';
    }
}

void sirNr::sort()
{
    for (int i=0;i<nr_elem;i++)
        for (int j=0;j<nr_elem;j++)
            if (v[j]<v[i])
            {
                NrMare temp=v[i];
                v[i]=v[j];
                v[j]=temp;
            }
}

void sirNr::trim()
{
    int x=0,t=nr_elem;
    x=~x;
    x=x>>1;
    cout<<"x="<<x<<endl;
    long suma;
    for (int i=0;i<t;i++)
        if (v[i].getVal()<x)
        {
            suma+=v[i].getVal();
            v.erase(v.begin()+i);
            nr_elem--;
        }
    cout<<"suma="<<suma;
}
double sirNr::average()
{
    double media=0;
    for (int i=0;i<nr_elem;i++)
    {
        media+=v[i].getVal();
    }
    media=media/nr_elem;
    return media;
}
long sirNr::cmmdc()
{
    long rez=v[1].getVal();
    for (int i=0;i<nr_elem;i++)
        for (int j=0;j<nr_elem;j++)
            rez=cmmd(v[i].getVal(),v[j].getVal())<rez?cmmd(v[i].getVal(),v[j].getVal()):rez;
    return rez;
}

long sirNr::divide(short s)
{
    long prod=1;
    for (int i=0;i<nr_elem;i++)
        if (v[i].getVal()%s == 0)
            prod*=v[i].getVal();
    return prod;
}
bool sirNr::distinct()
{
    for (int i=0;i<nr_elem;i++)
        for (int j=0; j<nr_elem;j++)
            if (v[i]==v[j])
                return false;
    return true;
}
istream& operator>>(istream& in, sirNr& s)
{
    for (int i=0;i<s.nr_elem;i++)
        cout<<"x=",in>>s.v[i];
    return in;
}
ostream& operator<<(ostream& out, sirNr s)
{
    for (int i=0;i<s.nr_elem;i++)
        out<<s.v[i];
    return out;
}


long cmmd(long x, long y)
{
    int cmmdc,a=x,b=y,t;
    while (b!=0)
    {
        t=b;
        b=a%b;
        a=t;
    }
    cmmdc=a;
    return cmmdc;
}

int main()
{
    sirNr a,b;
    cin>>a;
    cin>>b;
    cout<<endl<<"maxim="<<a.maxim();
    cout<<"media="<<a.average()<<" cmmdc="<<a.cmmdc();
}